#include <Metro.h> //Include Metro library
const int out = 8;
const int in = 7;

void setup() {
  pinMode(out, OUTPUT); 
  pinMode(in, INPUT);    
}

const byte secondsToMax = 5;
byte outval;
unsigned long lastTime;

Metro ledMetro = Metro(5000); 

void loop()
{
  int in = analogRead(in);
  unsigned long time = millis();
  outval = time-lastTime*secondsToMax*1000 ;
  outval = map(in,0,1024,0,255);
  analogWrite(out,outval);
  
  if (ledMetro.check() == 1) {
    digitalWrite(out,HIGH);
    delay(1000);
    digitalWrite(out,LOW);
  }

}
